<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .a {
            width: 50px;
            height: 50px;
            background-color: #f00;
        }

        body {
            width: 3000px;
            height: 3000px;
        }
    </style>
</head>

<body>
    <div class="a"></div>

    <script>


        // e.clientX  e.clientY    鼠标到浏览器边缘的 坐标
        // e.pageX    e.pageY    鼠标到页面的实际距离




        document.onmousemove = function (e) {
            // console.log(e.clientX, e.clientY);
            console.log(e.clientX, e.pageX);
            // console.log();
        }

    </script>

</body>

</html>